| Yes | No | |
|---|---|---|
| Female | 509 | 116 |
| Male | 398 | 104 |
| \(J = 1\) | \(J = 2\) | ||
|---|---|---|---|
| \(I = 1\) | \(n_{11}\) | \(n_{12}\) | \(\color{white}{n_{1+}}\) |
| \(I = 2\) | \(n_{21}\) | \(n_{22}\) | |
| \(J = 1\) | \(J = 2\) | ||
|---|---|---|---|
| \(I = 1\) | \(n_{11}\) | \(n_{12}\) | \(n_{1+}\) |
| \(I = 2\) | \(n_{21}\) | \(n_{22}\) | \(n_{2+}\) |
| \(n_{+1}\) | \(n_{+2}\) | \(n\) |
| \(J = 1\) | \(J = 2\) | ||
|---|---|---|---|
| \(I = 1\) | \(p_{11}\) | \(p_{12}\) | \(\color{white}{p_{1+}}\) |
| \(I = 2\) | \(p_{21}\) | \(p_{22}\) | |
| \(J = 1\) | \(J = 2\) | ||
|---|---|---|---|
| \(I = 1\) | \(p_{11}\) | \(p_{12}\) | \(p_{1+}\) |
| \(I = 2\) | \(p_{21}\) | \(p_{22}\) | \(p_{2+}\) |
| \(p_{+1}\) | \(p_{+2}\) | \(1\) |
| \(Y\) = 1: Yes | \(Y\) = 2: No | ||
|---|---|---|---|
| \(X = 1\):Female | \(n_{11} = \color{red}{509}\) | \(n_{12} = \color{red}{116}\) | \(n_{1+} = \color{blue}{625}\) |
| \(X = 2\): Male | \(n_{21} = \color{red}{398}\) | \(n_{22} = \color{red}{104}\) | \(n_{2+} = \color{blue}{502}\) |
| \(n_{+1} = \color{blue}{907}\) | \(n_{+2} = \color{blue}{220}\) | \(n = \color{blue}{1127}\) |
| \(Y\) = 1: Yes | \(Y\) = 2: No | ||
|---|---|---|---|
| \(X = 1\):Female | \(p_{11} = \color{red}{0.452}\) | \(p_{12} = \color{red}{0.103}\) | \(p_{1+} = \color{blue}{0.555}\) |
| \(X = 2\): Male | \(p_{21} = \color{red}{0.353}\) | \(p_{22} = \color{red}{0.092}\) | \(p_{2+} = \color{blue}{0.445}\) |
| \(p_{+1} = \color{blue}{0.805}\) | \(p_{+2} = \color{blue}{0.195}\) | \(p = \color{blue}{1}\) |
| \(Y\) = 1: Yes | \(Y\) = 2: No | ||
|---|---|---|---|
| \(X = 1\):Female | \(n_{11} = \color{red}{509}\) | \(n_{12} = \color{red}{116}\) | \(n_{1+} = \color{blue}{625}\) |
| \(X = 2\): Male | \(n_{21} = \color{red}{398}\) | \(n_{22} = \color{red}{104}\) | \(n_{2+} = \color{blue}{502}\) |
| \(n_{+1} = \color{blue}{907}\) | \(n_{+2} = \color{blue}{220}\) | \(n = \color{blue}{1127}\) |
| \(Y\) = 1: Yes | \(Y\) = 2: No | ||
|---|---|---|---|
| \(X = 1\):Female | \(n_{11} = \color{red}{509}\) | \(n_{12} = \color{red}{116}\) | \(n_{1+} = \color{blue}{625}\) |
| \(X = 2\): Male | \(n_{21} = \color{red}{398}\) | \(n_{22} = \color{red}{104}\) | \(n_{2+} = \color{blue}{502}\) |
| \(n_{+1} = \color{blue}{907}\) | \(n_{+2} = \color{blue}{220}\) | \(n = \color{blue}{1127}\) |
| Positive | Negative | ||
|---|---|---|---|
| Diseased | 1 | 0 | 1 |
| Not diseased | 12 | 87 | 99 |
| 13 | 87 | 100 |
| Positive | Negative | ||
|---|---|---|---|
| Diseased | 1 | 0 | 1 |
| Not diseased | 12 | 87 | 99 |
| 13 | 87 | 100 |
| Positive | Negative | ||
|---|---|---|---|
| Diseased | 1 | 0 | 1 |
| Not diseased | 12 | 87 | 99 |
| 13 | 87 | 100 |
| Positive | Negative | ||
|---|---|---|---|
| Diseased | 26 | 4 | 30 |
| Not diseased | 8 | 62 | 70 |
| 32 | 66 | 100 |
The marginal frequencies of a contingency table can be fixed or random
Fixed: Chosen by the researcher
Random: Vary depending on the sample
Note 1: “Fixed” and “random” are kind of (but not exactly) like “manipulated” and “measured”
Note 2: This is just one of many definitions of “fixed vs random”
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | |||
| Aspirin | |||
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | Random | ||
| Aspirin | Random | ||
| Random | Random | Fixed |
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | Random | ||
| Aspirin | Random | ||
| Fixed | Fixed |
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | Fixed | ||
| Aspirin | Fixed | ||
| Random | Random |
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | 189 | 10845 | \(\textbf{11034}\) |
| Aspirin | 104 | 10933 | \(\textbf{11037}\) |
| 293 | 21778 | 22071 |
\[\theta = \frac{odds_1}{odds_2} = \frac{p_1/(1 - p_1)}{p_2/(1 - p_2)} = \frac{n_{11}/n_{12}}{n_{21}/n_{22}} = \frac{n_{11}n_{22}}{n_{12}n_{21}}\]
| Measure | Study design | Calculation | Example value |
|---|---|---|---|
| Difference in proportion | Prospective | \(p_1 - p_2\) | 0.008 |
| Relative risk | Prospective | \(\frac{p_1}{p_2}\) | 1.818 |
| Odds ratio | Any design | \(\frac{p_1/(1 - p_1)}{p_2/(1 - p_2)}\) | 1.832 |
\[odds~ratio = \frac{p_1/(1 - p_1)}{p_2/(1 - p_2)} = relative~risk \frac{(1 - p_1)}{(1 - p_2)} \]
\[E(XY) = E(X) E(Y) - cov(XY)\]
\[E(XY) = E(X) E(Y)\]
Expected joint frequencies: \(\mu_{ij} = \frac{n_{i+} n_{+j}}{n}\)
Expected joint frequencies
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | \(\mu_{11} = \frac{n_{1+} n_{+1}}{n}\) | \(\mu_{12} = \frac{n_{1+} n_{+2}}{n}\) | \(n_{1+}\) |
| Aspirin | \(\mu_{21} = \frac{n_{2+} n_{+1}}{n}\) | \(\mu_{22} = \frac{n_{2+} n_{+2}}{n}\) | \(n_{2+}\) |
| \(n_{+1}\) | \(n_{+2}\) | \(n\) |
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | 189 | 10845 | 11034 |
| Aspirin | 104 | 10933 | 11037 |
| 293 | 21778 | 22071 |
| Heart attack | No heart attack | \(\color{white}{White text}\) | |
|---|---|---|---|
| Placebo | 146.48 | 10887.52 | 11034 |
| Aspirin | 146.52 | 10890.48 | 11037 |
| 293 | 21778 | 22071 |
\[\chi^2 = \sum\left(\frac{(n_{ij} - \mu_{ij})^2}{\mu_{ij}}\right)\]
\(\chi^2 = \sum\left(\frac{(n_{ij} - \mu_{ij})^2}{\mu_{ij}}\right) =\)
\(\frac{(189 - 146.48)^2}{146.48} + \frac{(10845 - 10887.52)^2}{10887.52} + \frac{(104 - 146.52)^2}{146.52} + \frac{(10933 - 10890.48)^2}{10890.48} =\)
\(12.343 + 0.166 + 12.339 + 0.166 = 25.014\)
| Guess tea | Guess milk | ||
|---|---|---|---|
| Tea first | \(n_{11}\) | \(n_{12}\) | \(\textbf{4}\) |
| Milk first | \(n_{21}\) | \(n_{22}\) | \(\textbf{4}\) |
| \(\textbf{4}\) | \(\textbf{4}\) | 8 |
| Guess tea | Guess milk | ||
|---|---|---|---|
| Tea first | 3 | 1 | \(\textbf{4}\) |
| Milk first | 1 | 3 | \(\textbf{4}\) |
| \(\textbf{4}\) | \(\textbf{4}\) | 8 |